package com.ebupt.migu.music.common.tree;

import com.google.gson.Gson;
import lombok.Data;

import java.util.List;

@Data
public class TreeNode {

    private String id;
    private String parentId;
    private String name;
    private Boolean checked;

    private List<TreeNode> children;

    public TreeNode(String id, String name, String parentId, Boolean checked) {
        this.id = id;
        this.parentId = parentId;
        this.name = name;
        this.checked = checked;
    }

    public TreeNode(String id, String name, TreeNode parent) {
        this.id = id;
        this.parentId = parent.getId();
        this.name = name;
    }

    @Override
    public String toString() {
        Gson gson = new Gson();
        return gson.toJson(this);
    }
}